import 'package:yt_devops/components/yt_expandable_tree/model/tree_mode.dart';
import 'package:yt_devops/utils/func_utils.dart';

enum MultiColumnPickerType {
  /// 单选
  radio,

  /// 多选
  checkbox,

  unLimit
}

class MultiColumnModel<T> extends TreeNode<T> {
  final List<MultiColumnModel<T>> selectList;

  MultiColumnPickerType pickerType;

  MultiColumnModel(
    super.value, {
    super.title,
    super.subNodes,
    super.selectable,
    this.pickerType = MultiColumnPickerType.radio,
    this.selectList = const [],
  })  : assert(!(!FuncUtils.isListEmpty(subNodes) &&
            !FuncUtils.isListEmpty(selectList))),
        super(
          checkable: pickerType != MultiColumnPickerType.unLimit,
        );

  bool isUnLimit() {
    return pickerType == MultiColumnPickerType.unLimit ||
        (FuncUtils.isEmpty(value) && pickerType == MultiColumnPickerType.radio);
  }
}
